import request from '@/utils/request';
import { harborRequest } from '@/utils/request';

const prefix = '/apharbor'

export async function getImageList(data) {
  return request(`${prefix}/api/v1/images/image`, {
    method: 'GET',
    params:data,
  })
}

export async function getPublicImageList(data) {
  return request(`${prefix}/api/v1/images/publicImage`, {
    method: 'GET',
    params:data,
  })
}

export async function uploadImage(data) {
  return request(`${prefix}/api/v1/images/image`, {
    method: 'POST',
    data:data,
  })
}

export  function getImageDetail(id) {
  return request(`${prefix}/api/v1/images/image/${id}`, {
    method: 'GET',
  })
}
export async function deleteImage(id) {
  return request(`${prefix}/api/v1/images/image/${id}`, {
    method: 'DELETE',
  })
}
export async function getImageVersions(id) {
  return request(`${prefix}/api/v1/images/imageVersion/${id}`, {
    method: 'GET',
  })
}

export async function deleteImageVersion(id) {
  return request(`${prefix}/api/v1/images/imageVersion/${id}`, {
    method: 'DELETE',
  })
}

export async function pullImage(data) {
  return request(`${prefix}/api/v1/images/image/uploadFromDockerhub`, {
    method: 'POST',
    data:data
  })
}



export async function getPvc(id) {
  return request(`/file-server/api/v1/files/info/${id}`, {
    method: 'GET',
  });
}


export const getPullStatus = async () => harborRequest('/images/image/getTaskStatus');








